package com.zjh.controller;

import com.zjh.service.KafkaProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KafkaController {
    @Autowired
    KafkaProducer kafkaProducer;


    @PostMapping("/publish")
    public String publish(@RequestParam("message") String message) {
        kafkaProducer.sendMessage("my_topic",message);
        return "Message published successfully";
    }
}
